Repository navigation
fix(server): this Mac's pairings and agent setting live outside the library (ISSUE-38) - #35
Conversation
…ibrary (ISSUE-38) A cloned or synced library could bring its own .viewswitcher/devices.json (someone else's paired devices) or a looser settings.json. Both are this Mac's, not the library's, so they move to ~/Library/Application Support/ViewSwitcher/libraries/<library path's hash> (VIEWSWITCHER_STATE moves the root; machine-state.ts). Once, at startup: the agent setting carries over only when it's "never"; paired devices never carry over (phones and tablets pair again); the old copies are removed from the library. Hand edits are still followed, by watching the new folder. Tests never touch the real Application Support: bunfig.toml preloads test-setup.ts, which points VIEWSWITCHER_STATE at a temp folder for every test and every server a test starts; e2e does the same. README, SECURITY.md, the glossary and the comments say where they live now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QyQdJ1ZdpFyktLPZbQXJSh
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 32 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Mac app end-to-end at 492c99b: |
… state keyed by the real path, migration fails closed (ISSUE-38) - A run from apps/server didn't load the root bunfig.toml, so tests that spawn the server directly wrote to the real Application Support. Every spawn now passes test-server's TEST_STATE_ROOT, and a server under bun test (NODE_ENV=test) with no VIEWSWITCHER_STATE refuses to start (config.ts), tested in config.test.ts. ipad-shots.sh gets its own state folder. - machineStateDir keys on the library's real path, computed after the library exists, so a link or another spelling of it is the same library. - The migration reads the old file as settings.ts did: a malformed file or a bad value meant "never" and carries over as that; no setting yet is the default. Its result says "dropped" when this Mac's own setting was kept, and failing to remove an old file is logged, not fatal. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QyQdJ1ZdpFyktLPZbQXJSh
|
Correction to my e2e comment above: I wrote that nothing landed in the real Fixed in the latest commit: every spawn passes |
|
Deployment failed for project viewswitcher-site with the following error: Learn More: https://vercel.com/2witstudios-projects?upgradeToPro=build-rate-limit |
… kept, so the log doesn't claim a reset (ISSUE-38) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QyQdJ1ZdpFyktLPZbQXJSh
|
Deployment failed for project viewswitcher-site with the following error: Learn More: https://vercel.com/2witstudios-projects?upgradeToPro=build-rate-limit |
What this delivers
This Mac's paired phones and tablets (
devices.json) and its agent on-air setting (settings.json) now live with the Mac, not in the library. Before, a cloned or synced library could bring someone else's paired devices, which then count as paired once Wi-Fi is on, or a looser agent setting.~/Library/Application Support/ViewSwitcher/libraries/<hash of the library path>(apps/server/src/machine-state.ts,config.machineState).VIEWSWITCHER_STATEmoves the root. The on-air record and the kit's bookkeeping stay in the library's.viewswitcher/, because they describe the library.bunfig.tomlpreloadstest-setup.ts, which pointsVIEWSWITCHER_STATEat a temp folder for every test and every server a test starts.mac:e2edoes the same.Tasks: ISSUE-38
How it was checked
Locally on macOS with Bun 1.4.2:
bun test: 4598 pass, 0 fail, from the repo root and fromapps/server. Neither run adds anything to the real Application Support. New tests:machine-state.test.ts: the folder per library path; devices are dropped, not trusted; "never" carries over and "always" doesn't; this Mac's setting is never overwritten.settings-follow.test.ts: a real server follows a hand edit in the new folder and ignores asettings.jsonthat appears in the library.bun run typecheck: clean.astro check: 0 errors.mac:build --app+mac:e2e: see the comment that follows.Notes for review
TEST_STATE_ROOT, and a server underbun testwithoutVIEWSWITCHER_STATErefuses to start); the state is keyed by the library's real path; the migration reads the old file assettings.tsdid (malformed means never); a kept-own result for the log;ipad-shots.sh's own state folder. Two folders an earlier test run left in the real Application Support were removed (neither was the real library's).PageSpace
Builder: owner (Claude Code session)
Criteria
apps/server/src/machine-state.ts,config.tsmachineState,main.ts(migration and watch),settings.ts,http/routes/agent.tsapps/server/src/machine-state.test.ts,apps/server/src/settings-follow.test.ts,apps/server/src/mcp/http.test.tsmac:e2eall checks passed🤖 Generated with Claude Code
https://claude.ai/code/session_01QyQdJ1ZdpFyktLPZbQXJSh